package com.ydev.lazywallet.gui;

import org.Global;
import org.ydClipBoardManager;
import org.ydSharedPreference;

import com.ydev.lazywallet.R;
import com.ydev.lazywallet.R.layout;
import com.ydev.lazywallet.R.menu;

import android.os.Bundle;
import android.provider.SyncStateContract.Constants;
import android.app.Activity;
import android.content.Intent;
import android.view.Menu;
import android.view.View;
import android.widget.EditText;

public class EnterKey extends Activity {

	EditText etKey;
	
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_enter_key);
		etKey=(EditText)findViewById(R.id.editText1);
		ydClipBoardManager.init(this);
		ydSharedPreference.initialize(this);
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.enter_key, menu);
		return true;
	}
	
	public void EnterClicked(View v){
		Global.encryptionKey=etKey.getText().toString();
		Global.loadData();
		//getData();
		
		Intent intent = new Intent(getApplicationContext(), Home.class);
		intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
		startActivity(intent);
	}
	
	public void getData(){
		Global.sampleData=ydSharedPreference.getFromPref(org.Constants.Key_Data);
		if(Global.sampleData.equalsIgnoreCase("nothing")){
			Global.sampleData="";
		}
	}

}
